﻿* Encoding: UTF-8.

*Part One: Codes for computing variable correlations (Table1)

DATASET ACTIVATE DataSet1.
COMPUTE goalr_M=Mean(goalr1,goalr2,goalr3,goalr4).
EXECUTE.

DATASET ACTIVATE DataSet1.
COMPUTE gomap_M=Mean(gomap1,gomap2,gomap3,gomap4).
EXECUTE.

DATASET ACTIVATE DataSet1.
COMPUTE gomav_M=Mean(gomav1,gomav2,gomav3).
EXECUTE.

DATASET ACTIVATE DataSet1.
COMPUTE goab_M=Mean(goab1,goab2,goab3,goab4).
EXECUTE.

DATASET ACTIVATE DataSet1.
COMPUTE te_M=Mean(tese1,tese2,tese3,tese4,teis1,teis2,teis3,teis4,tecm1,tecm2,tecm3,tecm4).
EXECUTE.

DATASET ACTIVATE DataSet1.
COMPUTE s1tsr_M=Mean(s1tsr1,s1tsr2,s1tsr3,s1tsr4,s1tsr5,s1tsr6,s1tsr7,s1tsr8,s1tsr9,s1tsr10,s1tsr11r,s1tsr12r).
EXECUTE.

DATASET ACTIVATE DataSet1.
COMPUTE s1ce_M=Mean(s1cebe1,s1cebe2,s1cebe3,s1cebe4,s1cebe5,s1ceee1,s1ceee2,s1ceee3,s1ceee4,s1ceee5).
EXECUTE.

CORRELATIONS
  /VARIABLES=goalr_M gomap_M gomav_M goab_M te_M s1tsr_M s1ce_M
  /PRINT=TWOTAIL NOSIG
  /MISSING=PAIRWISE.

*Part Two: Codes for computing the main SEM model in Mplus (Figure 1)
To import the data in Mplus, save the dataset as a .dat file (tab delimited) and unclick "writing variable names to file". Rename it as "goaldata"
Heads-up: Do not include additional mean variables (or use the original data file)

TITLE: main SEM;
DATA: FILE=goaldata.dat;

VARIABLE: NAMES = y1-y64; 
    !Variables are renamed according to their order in SPSS. 
    !For example, y1 = Covid and y64 = s1tsr12r. 
USEVARIABLES= y10-y20 y43-y44 y55-y62; 

MISSING = ALL(-99);
ANALYSIS: Estimator = ml; 
MODEL:  	
            gomap BY y10-y13;
            gomav BY y14-y16;
            goab BY y17-y20;
            te BY y55-y56;
            s1tsrs BY y57 y58;
            s1tsri BY y59 y60;
            s1tsrc BY y43 y44; 
            s1tsr BY s1tsrs s1tsri s1tsrc;	
            s1ce BY y61 y62;
      	
            te ON gomap gomav goab;
            s1tsr ON te gomap gomav goab;
            s1ce ON te gomap gomav goab;
        	
            gomap WITH gomav;
            gomap WITH goab;
            gomav WITH goab;

MODEL INDIRECT:
            s1tsr IND gomap;
            s1tsr IND gomav;
            s1tsr IND goab;
            s1ce IND gomap;
            s1ce IND gomav;
            s1ce IND goab;

OUTPUT: sampstat standardized modindices;

*Part Three: Codes for computing the main SEM model with 5000 bootstrapped iterations (Table 2)
To import the data in Mplus, save the dataset as a .dat file (tab delimited) and unclick "writing variable names to file". Rename it as "goaldata"
Heads-up: Do not include additional mean variables (or use the original data file)

*Use the syntax above and add the bootstrapping code after ANALYSIS and the CI code (confidence interval) after OUTPUT

e.g., ANALYSIS: Estimator = ml; Bootstrap = 5000;
e.g., OUTPUT: sampstat standardized CINTERVAL (BOOTSTRAP);



*Additional codes for parceled items

DATASET ACTIVATE DataSet1.
COMPUTE tep1=Mean(tese1,tese2,teis1,teis2,tecm1,tecm2).
EXECUTE.

DATASET ACTIVATE DataSet1.
COMPUTE tep2=Mean(tese3,tese4,teis3,teis4,tecm3,tecm4).
EXECUTE.

DATASET ACTIVATE DataSet1.
COMPUTE s1tsrs1=Mean(s1tsr1,s1tsr2,s1tsr3).
EXECUTE.

DATASET ACTIVATE DataSet1.
COMPUTE s1tsrs2=Mean(s1tsr4,s1tsr5).
EXECUTE.

DATASET ACTIVATE DataSet1.
COMPUTE s1tsri1=Mean(s1tsr6,s1tsr7,s1tsr8).
EXECUTE.

DATASET ACTIVATE DataSet1.
COMPUTE s1tsri2=Mean(s1tsr9,s1tsr10).
EXECUTE.

DATASET ACTIVATE DataSet1.
COMPUTE s1cep1=Mean(s1cebe1,s1cebe2,s1cebe3,s1ceee1,s1ceee2,s1ceee3).
EXECUTE.

DATASET ACTIVATE DataSet1.
COMPUTE s1cep2=Mean(s1cebe4,s1cebe5,s1ceee4,s1ceee5).
EXECUTE.


